import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@WebFilter(urlPatterns = {"/one_"})
public class loginfilter extends HttpFilter {
    @Override
    protected void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws ServletException, IOException{
        HttpServletRequest reqq = (HttpServletRequest) req;
        HttpServletResponse ress=(HttpServletResponse) res;
        HttpSession session = (HttpSession) reqq.getSession().getAttribute("user");
        if( session!=null ){
            ress.sendRedirect("Interface2.jsp");
        }
        chain.doFilter(reqq,ress);
    }
}

